<?php
/*
+--------------------------------------------------------------------------
|   AffiliStore 2
|   ========================================
|   Web: http://www.affilistore.com
|   Email: admin (at) affilistore (dot) com
|	License Type: AffiliStore 2 is NOT open source software and limitations apply 
|   Licence Info: Visit AffiliStore website and click on 'Licence'
+--------------------------------------------------------------------------
*/
require_once('includes/connect.php');
require_once('includes/functions.php');
require_once('includes/head.inc.php');

//$pieces = str_replace(",", " ", $_GET['as_ps']);
$pieces = explode(",", $_GET['as_ps']);
$kp = count($pieces);
	for ($i = 0; $i < $kp; $i++) {
	$handler .= "(prodName LIKE '%".noquote_smart($pieces[$i])."%' OR prodBrand LIKE '%".noquote_smart($pieces[$i])."%' OR prodCategory LIKE '%".noquote_smart($pieces[$i])."%' OR prodDescription LIKE '%".noquote_smart($pieces[$i])."%' OR prodPromoText LIKE '%".noquote_smart($pieces[$i])."%' OR merchantProdID LIKE '%".noquote_smart($pieces[$i])."%' OR prodPrice LIKE '%".noquote_smart($pieces[$i])."%')";
		if ($i != $kp-1) {
		$handler .= " OR ";
		} else {
		$handler .= ") AND prodPrice BETWEEN ".quote_smart($_GET['as_pfrom'])." AND ".quote_smart($_GET['as_plim'])." ";
		}
	}

$sql = "SELECT * FROM affiliSt_products1 WHERE ($handler ORDER BY prodPrice DESC LIMIT 0,".noquote_smart($_GET['as_p'])."";
$getContent = mysql_query($sql, $databaseConnect) or die(mysql_error());
$content = mysql_fetch_assoc($getContent);


$totalProducts = mysql_num_rows($getContent);
$totalColumns = $_GET['as_c'];
$columnCount = 0;
$productCount = 0;
?>
<?php if ($_GET['as_js'] == 1) {
$jopen = "document.write('";
$jclose = "');";
} else {
$jopen = "";
$jclose = "";
} ?>
<?php echo $jopen ?><table cellpadding="<?php echo $_GET['as_cp'] ?>" cellspacing="<?php echo $_GET['as_cs'] ?>" border="<?php echo $_GET['as_b'] ?>" width="<?php echo $_GET['as_w'] ?>"><tr><?php do { ?><td align="<?php echo $_GET['as_align'] ?>" valign="<?php echo $_GET['as_valign'] ?>" style="font-family:<?php echo $_GET['as_font'] ?>; font-size:<?php echo $_GET['as_size'] ?>"><?php echo '<img src="'.$content['prodImageURL'].'" width="'.$_GET['as_iw'].'" height="'.$_GET['as_ih'].'" alt="'.$content['prodName'].'" /><br />'; echo $content['prodName'].'<br />'; echo '<strong style="color:green">'.$content['prodCurrency'].$content['prodPrice'].'</strong><br />'; echo '<a href="'.$installDir['value'].'go.php?proddb='.$content['prodDB'].'&amp;l='.$content['dbProdID'].'" target="'.$_GET['as_target'].'"><strong>Buy Now</strong></a><br /><br />'; ?></td><?php $columnCount++; $productCount++; if ($columnCount == $totalColumns && $productCount != $totalProducts) { echo "</tr><tr>"; $columnCount = 0; } } while ($content = mysql_fetch_assoc($getContent)); ?></tr></table><?php echo $jclose ?>

